package cn.edu.scau.cmi.wujiaxian.exercise7;

interface DogState {
	public void showState();
}

class SoftlyState implements DogState {

	@Override
	public void showState() {
		System.out.println("Softly");
	}
	
}

class MeetEnemyState implements DogState {

	@Override
	public void showState() {
		System.out.println("MeetEnemy");
	}
	
}

class MeetFriendState implements DogState {

	@Override
	public void showState() {
		System.out.println("MeetFriend");
	}
	
}

class Dog {
	DogState state;
	public void cry() {
		state.showState();
	}
	public void setState(DogState s) {
		this.state = s;
	}
}

public class CheckDogState {
	public static void main(String[] args) {
		Dog yellowDog = new Dog();
		yellowDog.setState(new SoftlyState());
		yellowDog.cry();
		yellowDog.setState(new MeetEnemyState());
		yellowDog.cry();
		yellowDog.setState(new MeetFriendState());
		yellowDog.cry();
	}
}
